package com.nanyang.tms.domain.bill.context;

import com.nanyang.common.core.flow.context.AbsTransHandlerContext;
import com.nanyang.tms.domain.cost.context.CalculateCostFreightContext;
import com.nanyang.tms.domain.forecast.context.CalculateFreightContext;
import lombok.Data;

import java.io.Serializable;
@Data
public class BillSolveContext extends AbsTransHandlerContext implements Serializable {
    private static final long serialVersionUID = 4567376569653168310L;
    private CalculateFreightContext calculateFreightContext;
    private CalculateCostFreightContext calculateCostFreightContext;
    private BillUpdateContext billUpdateContext;

    public BillSolveContext() {
        this.calculateFreightContext = new CalculateFreightContext();
        this.calculateCostFreightContext = new CalculateCostFreightContext();
        this.billUpdateContext = new BillUpdateContext();
    }

    @Override
    public Object getTransHandlerContext(Class<?> cls) {
        if (cls.getSimpleName().equals("CalculateFreightContext")){
            return this.getCalculateFreightContext();
        }else if (cls.getSimpleName().equals("CalculateCostFreightContext")){
            return this.getCalculateCostFreightContext();
        }else if (cls.getSimpleName().equals("BillUpdateContext")){
            return this.getBillUpdateContext();
        }else{
            throw new RuntimeException("无此属性");
        }
    }
}
